import { Select } from "@element-plus/icons-vue";
import { defineStore } from "pinia";

export const Hotaldata = defineStore(

    // 当前存储库的唯一键
    'hotal_data',
    {
        // 存储库，他必须以一个函数的形式存在，在函数里面返回具体要存储的数据或者对象
        state: () => {
            return {
                hotal: {},
                centerDialogVisible: false,
                select_state: false,
                //酒店页面初始推荐数据
                a_recommendlist:
                    [

                        {
                            id: 1, name: '首都宾馆', star: '4', img: '1.jpg', transport: ['天安门', '北京西站'], tag: ['单份早餐', '到店付款', '会议厅'], grade: '很棒', score: '4.9', evaluate: '200+消费', hotelType: "酒店", brand: null,
                            homeInfo: [
                                { homeType: "大床房", homeNumber: 5, homePrice: 278, homeId: "1" },
                                { homeType: "双床房", homeNumber: 6, homePrice: 298, homeId: "12" },
                                { homeType: "单床房", homeNumber: 10, homePrice: 178, homeId: "9" }
                            ]
                        },
                        {
                            id: 2, name: '北京京伦饭店', star: '5', img: '2.jpg', transport: ['三里屯', '国贸地区'], tag: ['停车场', '在线付款', 'SPA'], grade: '不错', score: '4.5', evaluate: '290+消费', hotelType: "酒店", brand: null,
                            homeInfo: [
                                { homeType: "大床房", homeNumber: 5, homePrice: 378, homeId: "1" },
                                { homeType: "双床房", homeNumber: 6, homePrice: 398, homeId: "12" },
                                { homeType: "单床房", homeNumber: 10, homePrice: 182, homeId: "9" }
                            ]
                        },
                        {
                            id: 3, name: '北京宝格丽酒店', star: '4', img: '3.jpg', transport: ['八达岭长城', '北京南苑机场', '五道口'], tag: ['游泳池', '到店付款', '免费停车'], grade: '超棒', score: '5.0', evaluate: '200+消费', hotelType: "酒店", brand: null,
                            homeInfo: [
                                { homeType: "大床房", homeNumber: 5, homePrice: 1202, homeId: "1" },
                                { homeType: "双床房", homeNumber: 6, homePrice: 1502, homeId: "12" },
                                { homeType: "单床房", homeNumber: 10, homePrice: 1102, homeId: "9" }
                            ]
                        },
                        {
                            id: 4, name: '文华东方酒店', star: '5', img: '5.jpg', transport: ['天安门', '人民英雄纪念碑', '北海公园'], tag: ['单份早餐', '在线付款', '免费停车'], grade: '不错', score: '4.7', evaluate: '240+消费', hotelType: "酒店", brand: null,
                            homeInfo: [
                                { homeType: "大床房", homeNumber: 5, homePrice: "378", homeId: "1" },
                                { homeType: "双床房", homeNumber: 6, homePrice: "398", homeId: "12" },
                                { homeType: "单床房", homeNumber: 10, homePrice: "182", homeId:"9" }
                            ]
                        },
                        {
                            id: 5, name: '北京新世界中心同派酒店', star: '4', img: '4.jpg', transport: ['前门大街', '北海公园', '天坛公园'], tag: ['桌球室', '闪住', '多份早餐', '行李寄存'], grade: '超棒', score: '5.0', evaluate: '800+消费', hotelType: "酒店", brand: null,
                            homeInfo: [
                                { homeType: "大床房", homeNumber: 5, homePrice: "1468", homeId: "1" },
                                { homeType: "双床房", homeNumber: 6, homePrice: "1868", homeId: "12" },
                                { homeType: "单床房", homeNumber: 10, homePrice: "1068", homeId: "9" }
                            ]
                        },
                    ],
                Select_storeData: {
                    city: null,  //酒店城市
                    hotelTime: null,     //入住时间
                    number: null,       //入住人数
                    nameOrTransport: null, //关键字筛选
                    transport:null,  //区域位置
                    star:null,  //星级
                    tag: null,   //标签
                    hotalType: null,  //酒店类型
                    homePrice: null,  //房间价格
                    brand: null,  //酒店品牌
                    score: null  //评分

                }
            }
        },

        // 相当于计算属性 computed
        getters: {},

        // 可以处理异步或者同步方法逻辑
        actions: {},
        persist: {
            key: 'hotal_data', //存储名称
            storage: sessionStorage, // 存储方式
            paths: ['hotal'], //指定 state 中哪些数据需要被持久化。[] 表示不持久化任何状态，undefined 或 null 表示持久化整个 state
        }
    });